package Thread;

import Composite.*;
import images.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;


public class ThreadCreationVignette extends Thread{
    
    private ArrayList mesElements;
    private VignettesListModel model;
    
    public ThreadCreationVignette(VignettesListModel model){
        
        this.model=model;
        this.mesElements=new ArrayList(model.getModelAdapte().getDossiers());
        
    }
    
    public void run(){
        
        Iterator it=this.mesElements.iterator();
        while(it.hasNext()){
            
            Element element = (Element)it.next();
            if(element instanceof Photo){
                try {

                    Photo suiv = (Photo) element;
                    suiv.creerVignette(100, 100);
                    this.model.mettreAJourStructure(this.mesElements.indexOf(suiv));
                    Thread.sleep(2);
                } catch (InterruptedException ex) {
                    Logger.getLogger(ThreadCreationVignette.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        
    }
}
